x86emul: correct handling of FPU insns faulting on memory write
authorJan Beulich <jbeulich@suse.com>
Tue, 21 Mar 2017 14:12:59 +0000 (15:12 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 Mar 2017 14:12:59 +0000 (15:12 +0100)
commita8fcd80c8f02a02e5c39cd9f76b2988b270d45e7
tree9b33143aed63b592621ba5585f98c13bcf0533ea
parent9b7c3fabbc942624dead58e3743556b7af4910be
x86emul: correct handling of FPU insns faulting on memory write

When an FPU instruction with a memory destination fails during the
memory write, it should not affect FPU register state. Due to the way
we emulate FPU (and SIMD) instructions, we can only guarantee this by
- backing out changes to the FPU register state in such a case or
- doing a descriptor read and/or page walk up front, perhaps with the
  stubs accessing the actual memory location then.
The latter would require a significant change in how the emulator does
its guest memory accessing, so for now the former variant is being
chosen.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com> [hvm/emulate.c]
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
tools/fuzz/x86_instruction_emulator/fuzz-emul.c
tools/tests/x86_emulator/test_x86_emulator.c
tools/tests/x86_emulator/x86_emulate.c
tools/tests/x86_emulator/x86_emulate.h
xen/arch/x86/hvm/emulate.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h
xen/include/asm-x86/hvm/hvm.h